<include file="Public/header"/>
<div class="row">
    <div class="col-md-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>基本设置</h5>
            </div>
            <div class="ibox-content">
        <form class="layui-form" action="" autocomplete="off" id="baseForm">
            <input type="hidden" name="id" id="id" value="<{$vo.id}>">
            <div class="layui-form-item">
                <label class="layui-form-label">网站名称：</label>
                <div class="layui-input-block">
                    <input type="text" name="config[websitename]" value="<{$vo.websitename}>" lay-verify="title" lay-verify="required" autocomplete="off" placeholder="ZHIFUJIA合支付系统" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">网站地址：</label>
                <div class="layui-input-block">
                    <input type="text" name="config[domain]" value="<{$vo.domain}>" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" placeholder="例如：www.quefu.cn">
                </div>
            </div>

            <div class="layui-form-item">
                    <label class="layui-form-label">联系邮箱：</label>
                    <div class="layui-input-block">
                        <input type="email" name="config[email]" value="<{$vo.email}>"  lay-verify="email"
                               autocomplete="off"
                               class="layui-input" placeholder="例如：zhifu@quefu.cn">
                    </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">客服电话：</label>
                <div class="layui-input-block">
                    <input type="text" name="config[tel]" value="<{$vo.tel}>" autocomplete="off"
                           class="layui-input" placeholder="例如：400 0000 000 ">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">网站客服QQ：</label>
                <div class="layui-input-block">
                    <input type="text" name="config[qq]" value="<{$vo.qq}>" autocomplete="off"
                           class="layui-input" placeholder="多个QQ号用 | 分隔">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">网站后台目录：</label>
                <div class="layui-input-inline">
                    <input type="text" name="config[directory]" value="<{$vo.directory}>" placeholder="默认为Admin，留空为默认" autocomplete="off" class="layui-input" style="text-transform: capitalize;">
                </div>
                <div class="layui-form-mid layui-word-aux">注意：不能输入中文，只能是英文字母，不建议更改！</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">网站登录地址：</label>
                <div class="layui-input-inline">
                    <input type="text" name="config[login]" value="<{$vo.login}>" autocomplete="off"
                           class="layui-input" placeholder="多个QQ号用 | 分隔">
                </div>
                <div class="layui-form-mid layui-word-aux">注意：不能输入中文,只能是英文字母和数字，且字母开头，中间不能有字符出现.</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">网站备案号：</label>
                <div class="layui-input-block">
                    <input type="text" name="config[icp]" value="<{$vo.icp}>" autocomplete="off"
                           class="layui-input" placeholder="网站备案号">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">公司名称：</label>
                <div class="layui-input-block">
                    <input type="text" name="config[company]" value="<{$vo.company}>" autocomplete="off"
                           class="layui-input" placeholder="公司名称">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">授权KEY：</label>
                <div class="layui-input-block">
                    <input type="text" name="config[serverkey]" value="<{$vo.serverkey}>" autocomplete="off"
                           class="layui-input" placeholder="授权KEY，用于系统升级">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">商户代付：</label>
                <div class="layui-input-block">
                    <input type="radio" name="config[payingservice]" value="1" title="开启" <if
                        condition="$vo['payingservice'] eq 1">checked
                </if>>
                    <input type="radio" name="config[payingservice]" value="0" title="关闭" <if
                        condition="$vo['payingservice'] eq 0">checked
                </if>>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">商户认证：</label>
                <div class="layui-input-block">
                    <input type="radio" name="config[authorized]" value="1" title="开启" <if
                        condition="$vo['authorized'] eq 1">checked
                </if>>
                    <input type="radio" name="config[authorized]" value="0" title="关闭" <if
                        condition="$vo['authorized'] eq 0">checked
                </if>>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">邀请码注册：</label>
                <div class="layui-input-block">
                    <input type="radio" name="config[invitecode]" value="1" title="开启" <if
                        condition="$vo['invitecode'] eq 1">checked
                </if>>
                    <input type="radio" name="config[invitecode]" value="0" title="关闭" <if
                        condition="$vo['invitecode'] eq 0">checked
                </if>>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">提现通知：</label>
                <div class="layui-input-block">
                    <input type="radio" name="config[withdraw]" value="1" title="开启" <if
                        condition="$vo['withdraw'] eq 1">checked
                </if>>
                    <input type="radio" name="config[withdraw]" value="0" title="关闭" <if
                        condition="$vo['withdraw'] eq 0">checked
                </if>>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="add">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
            </div>
        </div>
    </div>
</div>
<include file="Public/footer"/>
<script>
layui.use(['form', 'laydate'], function(){
    var layer = layui.layer
        ,form = layui.form
        ,laydate = layui.laydate;
        //自定义验证规则
        form.verify({
            title: function(value){
                if(value.length < 5){
                    return '网站名称至少得写啊';
                }
            }
        });
        //监听提交
        form.on('submit(add)', function(data){
            $.ajax({
                url:"<{:U('System/saveBase')}>",
                type:"post",
                data:$('#baseForm').serialize(),
                success:function(res){
                    if(res.status){
                        layer.alert("操作成功", {icon: 6},function () {
                            location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                    }else{
                        layer.msg("操作失败!", {icon: 5},function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                        return false;
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>
